package com.fsi.client.util;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.Image;

/**
 * @author Alejandro D. Garin
 */
public class LoadingScreen extends DialogBox {
	private final Image image;
	private final Button closeButton = new Button("Close");

	public LoadingScreen() {
		this.setAnimationEnabled(true);
		this.setAutoHideEnabled(false);

		image = new Image();
		image.setUrl("images/loading.gif");
		this.add(image);
		setModal(true);
		setText("Loading...");

		closeButton.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				hide();
			}
		});

	}

}
